package com.dfec.water.dashboard.controller;

import com.dfec.common.utils.AjaxResult;
import com.dfec.water.service.YdbAreaBaseInfoService;
import com.dfec.water.service.YdbDeviceTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 大屏-实况监测
 *
 * @author tangrg
 * @email 1446232546@qq.com
 * @date 2025-02-2025/2/26 11:23:37
 */
@Tag(name = "大屏-实况监测")
@RestController
@RequestMapping("dashboard/monitor")
public class MonitorController {


    @Resource
    private YdbAreaBaseInfoService ydbAreaBaseInfoService;


    @Resource
    private YdbDeviceTypeService ydbDeviceTypeService;


    /**
     * 可视化-获取下边的大类
     */
    @GetMapping("/getAreaDeviceType")
    public AjaxResult getAreaDevices(@RequestParam Long areaId) {
        return AjaxResult.ok(ydbAreaBaseInfoService.getAreaDevices(areaId));
    }


    /**
     * 可视化-点击大类获取设备列表
     */
    @GetMapping("/getAreaDeviceList")
    public AjaxResult selectByAreaId(@RequestParam("areaId") Long areaId, @RequestParam("devType") Integer devType) {
        return AjaxResult.ok(ydbAreaBaseInfoService.selectByAreaId(areaId, devType));
    }


    /**
     * 获取设备数据
     */
    @GetMapping("/getDeviceData")
    @Operation(summary = "获取设备数据")
    public AjaxResult getDeviceData(@RequestParam("deviceId") Long deviceId, @RequestParam("deviceType") Integer deviceType,
                                    @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return ydbDeviceTypeService.getDeviceData(deviceId, deviceType, pageNo, pageSize);
    }


}
